package com.xxwy.study.client.dispatcher;

import com.xxwy.study.common.ResponseMessage;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * .
 *
 * @author xxwy
 * @date 2021/11/23 0023
 */
public class ResponseDispatcherHandler extends SimpleChannelInboundHandler<ResponseMessage> {

    private RequestPendingCenter requestPendingCenter = new RequestPendingCenter();

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, ResponseMessage msg) throws Exception {
        requestPendingCenter.set(msg.getMessageHeader().getStreamId(), msg.getMessageBody());
    }

    public RequestPendingCenter getRequestPendingCenter() {
        return requestPendingCenter;
    }
}
